<template>
  <div id="coupon_share_code">
    <c-title :hide="false" text="优惠券分享"></c-title>
    <share-code :shareInfo="info" :image="logo" :nums="nums" :new_coupon="$route.params.mark_id?true:false"></share-code>
    <div class="share-group flex">
      <div class="flex-a-c flex-j-c share-flex" @click="shareVideo">
        <div class="share-weixin">
          <div class="weixin share flex-a-c flex-j-c"><span class="iconfont icon-card_weixin"></span></div>
          <h3>分享好友</h3>
        </div>
      </div>
      <div class="flex-a-c flex-j-c share-flex" @click="getPoster">
        <div class="share-poster  ">
          <div class="poster share flex-a-c flex-j-c"><span class="iconfont icon-jk_haibao"></span></div>
          <h3>生成图片</h3>
        </div>
      </div>
    </div>
    <div class="play-video" v-if="showShare" style="z-index: 9999;" @click="close">
      <img src="../../assets/images/share_bg.png" alt />
    </div>
    <div class="c_imag">
        <div id="img_box" v-show="loadingImg">
        <div class="poster-img flex-a-c flex-j-c">
          <h1>扫码领取优惠券</h1>
          <h2>线上领取 轻松购</h2>
          <div class="nameBox">
            <!--avatar -->
            <img :src="avatar" alt="" />
          </div>
          <div class="userName">{{ posterName }}</div>
          <div class="recommend">向你分享了优惠券</div>
          <div class="code-mian">
            <div class="codeBox">
              <img :src="qr_code" alt="" />
            </div>
            <p>长按识别查看</p>
          </div>
          
        </div>
        
        </div>
        <!-- <div class="img-desc" v-show="loadingImg">长按保存图片</div> -->
      
    </div>
    <van-popup v-model="posterShow" round class="newcomerAward_popup" :style="{ height: '445px', backgroundColor: 'transparent' }">
      <img style="width:15.625rem;height: 27.8125rem;" id="thecanvas" v-show="!loadingImg" />
    </van-popup>
  </div>
</template>

<script>
import couponcontroller from "./shareShow_controller.js";

export default couponcontroller;
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
//新样式
.share-group {
  margin:-10px 15px 0 15px;
  background-color: #fff;
  border-radius: 1.25rem;
  padding:1.4063rem 0 1.25rem 0;
  position: relative;
  
  .share-flex {
    flex:1;
    .share-weixin {
    // flex:1;
      flex-direction: column;
      .weixin {
        background: linear-gradient(180deg, #38B44B 0%, #86DB67 100%);
      }
      .icon-card_weixin {
        font-size: 1.875rem;
        color:#fff;
      }
    }
    .share-poster {
      flex-direction: column;
      .poster {
        background: linear-gradient(168deg, #269AFF 0%, #87D6F9 100%);
      }
      .icon-jk_haibao {
        font-size: 1.25rem;
        color:#fff;
      }
    }
    .share-weixin,.share-poster {
      h3 {
        padding:0.5rem 0 0 0;
        font-size: 0.8125rem;
        font-weight: 400;
        color: #161616;
      }
    }
    .share {
      width: 3.125rem;
      height: 3.125rem;
      border-radius: 50%;
      flex:1;
    }
  }
}

.newcomerAward_popup {
  background-color: transparent;
}

#coupon_share_code {
  min-height: 100vh;
  width: 100%;
  // background-color: #fff;
}

.c_imag {
  position: absolute;
  left: -100rem;
  top: 0;
  // top:52px;
  // left:0;
}

#img_box {
  width:15.625rem;
  height: 27.8125rem;
  // box-shadow: -0.01rem 0.16rem 0.61rem 0.02rem rgba(81, 81, 81, 0.45);
  border-radius: 0.9375rem 0.9375rem 0.9375rem 0.9375rem;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  position: relative;
  background-image: url("../../assets/images/coupons-beijing@2x.png");
  .poster-img {
    flex-direction:column;
    h1 {
      font-size: 1.625rem;
      line-height: 1.625rem;
      font-weight: 800;
      color: #FFFFFF;
      text-align: center;
      padding:1.875rem 0 0.625rem 0;
    }
    h2 {
      font-size: 0.8125rem;
      font-weight: 400;
      color: #FFFFFF;
      padding:0 0 1.0625rem 0;
    }
    .nameBox {
      width: 2.75rem;
      height: 2.75rem;
      background-color: #fff;
      border-radius: 50%;
      padding:0.125rem;
      img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        display: block;
      }
    }
  }
  
  .code-mian {
    position: absolute;
    bottom:1.4375rem;
    left:50%;
    transform: translateX(-50%);
    z-index: 2;
    .codeBox {
      width: 4.25rem;
      height: 4.25rem;
      background: #FFFFFF;
      border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
      // padding:0.375rem;
      
      img {
        width: 100%;
        height: 100%;
        display: block;
        border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
        // position: absolute;
        // left:0;
        // top:0;
      }
    }
    p {
      padding:0.5rem 0 0 0;
      font-size: 0.5625rem;
      color: #6E6E79;
    }
  }
  

  .userName {
    padding:0.25rem 0 0.3125rem 0;
    font-size: 1rem;
    font-weight: bold;
    color: #3B3B4A;
  }

  .recommend {
    color: #6E6E79;
    font-size: 0.625rem;
  }
}
.img-desc {
  font-weight: 400;
  color: #FFFFFF;
  font-size: 0.875rem;
  text-align: center;
  padding:2rem;
}

.box {
  position: relative;
  background: #fff;
}

.play-video {
  position: absolute;
  z-index: 9;
  top: 0;
  width: 100%;
  height: 100%;
  left: 0;

  img {
    width: 100%;
    height: 100%;
  }
}
</style>
